﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;

namespace SalaDeEnsayo.WebApplication.Pages
{
    public class PopupPage : BasePage
    {
        #region Constantes
        public const string SCRIPT_FULLNAME = "SalaDeEnsayo.WebApplication.Scripts.PopUpScript.js";
        private const string CLOSE_SCRIPT_KEY = "ClosePopup";
        private const string RETURN_SCRIPT_KEY = "ReturnPopup";
        #endregion

        #region Métodos privados
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            ScriptManager.RegisterClientScriptResource(this, typeof(PopupPage), SCRIPT_FULLNAME);
        }

        private string ScriptPopupClose()
        {
            return String.Format("CloseWindow();");
        }
        #endregion

        #region Métodos públicos
        public void Close()
        {
            ScriptManager.RegisterStartupScript(this, typeof(PopupPage), CLOSE_SCRIPT_KEY, ScriptPopupClose(), true);
        }
        #endregion
    }
}
